#ifndef DEFINE_H
#define DEFINE_H

#include<boost/function.hpp>
//#define NET_DEBUG
//#define SINGLE_THREAD
namespace inm
{
    namespace net
    {
        enum EventType
        {
            ACCEPT_EVENT =  1<<0,
            READ_EVENT = 1<<1,
            WRITE_EVENT = 1<<2,
            ALL_EVENT = 1<<3    //for remove handler
            /*this default deal
            ERROR_EVENT = 1<<3,
            HUP_EVENT = 1<<4
            */

        };


        const short EVENT_ADD = 1;
        const short EVENT_DEL = 2;
        //as the tcpserver(....,short demultiplexerType)
        const short EPOLL = 1;
        const short POLL = 2;
        const short SELECT = 3;
        const short DEV_POLL = 4;
        const short KQUEUE = 5;

        /* not use enum because EVENT_ADD and EVENT_DEL cannot be | or &.they are mutual exclusion
        enum EventUpdateType
        {
            EVENT_ADD = 1<<0,
            EVENT_DEL = 1<<1
        };
*/
        class TcpConnect;
        class NetBuffer;
        class InetAddr;
        class EventHandler;
        class Timestamp;
        typedef boost::shared_ptr<TcpConnect> TcpConnectPtr;
        typedef boost::shared_ptr<EventHandler> EventHandlerPtr;
        //callback functions' name defination
        //when a new connect come--Acceptor use
        typedef boost::function<void (int,const InetAddr&,const Timestamp& )> NewConnectCallback;
        //when message has been read ok---TcpConnect use   Customized
        typedef boost::function<void (const TcpConnectPtr&,NetBuffer*,const Timestamp&)> MessageCallback;
        //connect established after accept ---TcpConnect use(in TcpConnect::established) Customized
        typedef boost::function<void (const TcpConnectPtr&)>  ConnectionCallback;
        //when tcp send ok  ---TcpConnect use  Customized
        typedef boost::function<void (const TcpConnectPtr&)>  WriteCompleteCallback;

        typedef boost::function<void (const TcpConnectPtr&,const Timestamp&)>  CloseCallback;

        //for pthread_create call  ----the same as defined in concurrency/thread.h
        //here is for DispatcherThreadPool
        typedef boost::function<void ()>  ThreadFunc;
        //fucntion task queue ---Dispatcher use
        typedef boost::function<void ()> Functor;

    };
};

#endif // DEFINE_H
